import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import '@/element'
import dataV from '@jiaminghi/data-view'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
//该文件为main.js
import printJS from 'print-js'


import VueParticles from 'vue-particles'
import scroll from 'vue-seamless-scroll'
import Print from 'vue-print-nb'
Vue.use(Print)
Vue.use(scroll)


Vue.use(VueParticles)

Vue.use(dataV)
Vue.use(ElementUI);


Vue.config.productionTip = false

function drag (el) {
  // console.log(el, '=================');
  let offX = 0, offY = 0
  el.onmousedown = (e) => {
      e.preventDefault()
      el.style.cursor = 'grabbing'
      let oX = e.clientX
      let oY = e.clientY

      document.onmousemove = e => {
          const x1 = e.clientX - oX
          const y1 = e.clientY -oY
          oX = e.clientX
          oY = e.clientY

          el.style.marginLeft = (x1 + offX) + 'px'
          el.style.marginTop = (y1 + offY) + 'px'
          offX = x1 + offX
          offY = y1 + offY
      }
      
      document.onmouseup = () => {
          el.style.cursor = 'grab'
          document.onmousemove = null
      }
  }
}

Vue.directive('drag', drag)

new Vue({
  router,
  store,
  render: h => h(App),
  beforeCreate () {
    Vue.prototype.$bus = this
  }
}).$mount('#app')
